Skip to content

Update dependency mysql2 to v3 [SECURITY]#12481

Open
renovate[bot] wants to merge 1 commit intomasterfrom
renovate/npm-mysql2-vulnerability
Open

Update dependency mysql2 to v3 [SECURITY]#12481
renovate[bot] wants to merge 1 commit intomasterfrom
renovate/npm-mysql2-vulnerability

Conversation

@renovate
Copy link
Copy Markdown

@renovate renovate Bot commented Apr 15, 2026

This PR contains the following updates:

Package Change Age Confidence
mysql2 (source) ^2.2.5^3.0.0 age confidence

mysql2 cache poisoning vulnerability

CVE-2024-21507 / GHSA-mqr2-w7wj-jjgr

More information

Details

Versions of the package mysql2 before 3.9.3 are vulnerable to Improper Input Validation through the keyFromFields function, resulting in cache poisoning. An attacker can inject a colon : character within a value of the attacker-crafted key.

Severity

  • CVSS Score: 6.9 / 10 (Medium)
  • Vector String: CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:N/VA:L/SC:N/SI:N/SA:N

References

This data is provided by the GitHub Advisory Database (CC-BY 4.0).


mysql2 vulnerable to Prototype Poisoning

CVE-2024-21509 / GHSA-49j4-86m8-q2jw

More information

Details

Versions of the package mysql2 before 3.9.4 are vulnerable to Prototype Poisoning due to insecure results object creation and improper user input sanitization passed through parserFn in text_parser.js and binary_parser.js.

Severity

  • CVSS Score: 6.9 / 10 (Medium)
  • Vector String: CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:L/VA:L/SC:N/SI:N/SA:N

References

This data is provided by the GitHub Advisory Database (CC-BY 4.0).


mysql2 Remote Code Execution (RCE) via the readCodeFor function

CVE-2024-21508 / GHSA-fpw7-j2hg-69v5

More information

Details

Versions of the package mysql2 before 3.9.4 are vulnerable to Remote Code Execution (RCE) via the readCodeFor function due to improper validation of the supportBigNumbers and bigNumberStrings values.

Severity

  • CVSS Score: 9.8 / 10 (Critical)
  • Vector String: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

References

This data is provided by the GitHub Advisory Database (CC-BY 4.0).


MySQL2 for Node Arbitrary Code Injection

CVE-2024-21511 / GHSA-4rch-2fh8-94vw

More information

Details

Versions of the package mysql2 before 3.9.7 are vulnerable to Arbitrary Code Injection due to improper sanitization of the timezone parameter in the readCodeFor function by calling a native MySQL Server date/time function.

Severity

  • CVSS Score: 9.8 / 10 (Critical)
  • Vector String: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

References

This data is provided by the GitHub Advisory Database (CC-BY 4.0).


mysql2 vulnerable to Prototype Pollution

CVE-2024-21512 / GHSA-pmh2-wpjm-fj45

More information

Details

Versions of the package mysql2 before 3.9.8 are vulnerable to Prototype Pollution due to improper user input sanitization passed to fields and tables when using nestTables.

Severity

  • CVSS Score: 8.2 / 10 (High)
  • Vector String: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:L

References

This data is provided by the GitHub Advisory Database (CC-BY 4.0).


Release Notes

sidorares/node-mysql2 (mysql2)

v3.9.8

Compare Source

Bug Fixes
  • security: sanitize fields and tables when using nestTables (#​2702) (efe3db5)
  • support deno + caching_sha2_password FULL_AUTHENTICATION_PACKET flow (#​2704) (2e03694)
  • typings: typo from jonServerPublicKey to onServerPublicKey (#​2699) (8b5f691)

v3.9.7

Compare Source

Bug Fixes
  • security: sanitize timezone parameter value to prevent code injection (#​2608) (7d4b098)

v3.9.6

Compare Source

Bug Fixes
  • binary parser sometimes reads out of packet bounds when results contain null and typecast is false (#​2601) (705835d)

v3.9.5

Compare Source

Bug Fixes

v3.9.4

Compare Source

Bug Fixes

v3.9.3

Compare Source

Bug Fixes
  • security: improve cache key formation (#​2424) (0d54b0c)
    • Fixes a potential parser cache poisoning attack vulnerability reported by Vsevolod Kokorin (Slonser) of Solidlab
  • update Amazon RDS SSL CA cert (#​2131) (d9dccfd)

v3.9.2

Compare Source

Bug Fixes

v3.9.1

Compare Source

Bug Fixes

v3.9.0

Compare Source

Features

v3.8.0

Compare Source

Features
Bug Fixes

v3.7.1

Compare Source

Bug Fixes
  • add condition which allows code in callback to be reachable (#​2376) (8d5b903)

v3.7.0

Compare Source

Features

v3.6.5

Compare Source

Bug Fixes
  • add decodeuricomponent to parse uri encoded special characters in host, username, password and datbase keys (#​2277) (fe573ad)

v3.6.4

Compare Source

Bug Fixes

v3.6.3

Compare Source

Bug Fixes
  • correctly pass values when used with sql-template-strings library (#​2266) (6444f99)

v3.6.2

Compare Source

Bug Fixes

v3.6.1

Compare Source

Bug Fixes
  • EventEmitter on method signatures to use spread syntax (#​2200) (5d21b81)

v3.6.0

Compare Source

Features

v3.5.2

Compare Source

Bug Fixes
  • Update events that are propagated from pool cluster to include remove (#​2114) (927d209)

v3.5.1

Compare Source

Bug Fixes
  • improvements to allow to use Bun and tls (#​2119) (fd44a2a)
  • missing ResultSetHeader[] to query and execute (f649486)

v3.5.0

Compare Source

Features

v3.4.5

Compare Source

Bug Fixes
  • handle prepare response with actual number of parameter definition less than reported in the prepare header. Fixes #​2052 (b658be0)

v3.4.4

Compare Source

Bug Fixes
  • add ProcedureCallPacket to execute overloads (3566ef7)
  • add ProcedureCallPacket to query overloads (352c3bc)
  • add ProcedureCallPacket to promise-based execute overloads (8292416)
  • add ProcedureCallPacket to promise-based query overloads (0f31a41)
  • create ProcedureCallPacket typings (09ad1d2)

v3.4.3

Compare Source

Bug Fixes

v3.4.2

Compare Source

Bug Fixes
  • changing type files to declaration type files (98e6f3a)

v3.4.1

Compare Source

Bug Fixes
  • createPool uri overload (98623dd)
  • PoolCluster typings (3902ca6)
  • create promise-based PoolCluster typings (7f38496)
  • missing parserCache in promise.js (7f35cf5)
  • missing constants in promise.js (4ce2c70)
  • missing keys for Types constant (86655ec)
  • missing typings for Charsets constants (01f77a0)
  • missing typings for CharsetToEncoding constants (609229a)
  • missing typings for parserCache (891a523)
  • missing typings for Types constant (04601dd)
  • rename file of typings Charsets constants (51c4196)

v3.4.0

Compare Source

Features
  • support STATE_GTIDS session track information (2b1520f)

v3.3.5

Compare Source

Bug Fixes

v3.3.4

Compare Source

Bug Fixes
  • PromisePoolConnection import name (76db54a)
  • releaseConnection types and promise (4aac9d6)

v3.3.3

Compare Source

Bug Fixes

v3.3.2

Compare Source

Bug Fixes

v3.3.1

Compare Source

Bug Fixes

v3.3.0

Compare Source

Features
  • Added updated/new error codes gathered from MySQL 8.0 source code (#​1990) (85dc6e5)

v3.2.4

Compare Source

Bug Fixes
  • server: Added missing encoding argument to server-handshake (#​1976) (a4b6b22)

v3.2.3

Compare Source

Bug Fixes

v3.2.2

Compare Source

Bug Fixes
  • ConnectionOptions conflict between mysql and mysql/promise (#​1955) (eca8bda)

v3.2.1

Compare Source

Bug Fixes
  • Add typings for Connection.promise(). (#​1949) (e3ca310)
  • PoolConnection redundancy when extending Connection interface in TypeScript (7c62d11)

v3.2.0

Compare Source

Features
  • maxVersion ssl option to tls.createSecureContext (0c40ef9)

v3.1.2

Compare Source

Bug Fixes
  • update lru-cache reset method to clear (114f266)

v3.1.1

Compare Source

Bug Fixes
  • remove accidental log in caching_sha2_password.js (c1202b6)

v3.1.0

Compare Source

Features
  • cleanup buffer/string conversions in hashing/xor helpers that were failing in Bun (a2392e2)
Bug Fixes
  • when port is pased as a string convert it to a number (Bun's net.connect does not automatically convert this) (703ecb2)

v3.0.1

Compare Source

Miscellaneous Chores

v3.0.0

Compare Source

  • named-placeholders library is updated to use newer lru-cache dependency, allowing it do dedupe and be shared between mysql2 and named-placeholders - #​1711, mysqljs/named-placeholders#19
  • chai and mocha moved to devDependencies #​1774
  • Amazon RDS ssl certificates updated including AWS China #​1754
  • TCP_NODELAY flag enabled, avoiding long connect timeout in some scenarios #​1751
  • typing improvements: #​1675, #​1674
  • fix: ensure pooled connections get released #​1666
Miscellaneous Chores

Configuration

📅 Schedule: (UTC)

  • Branch creation
    • ""
  • Automerge
    • At any time (no schedule defined)

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about these updates again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate Bot added the dependencies Pull requests that update a dependency file label Apr 15, 2026
@codesandbox
Copy link
Copy Markdown

codesandbox Bot commented Apr 15, 2026

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

@entelligence-ai-pr-reviews
Copy link
Copy Markdown

entelligence-ai-pr-reviews Bot commented Apr 15, 2026

EntelligenceAI PR Summary

Upgrades mysql2 to its latest major version (v3) and synchronizes the full dependency tree in the lockfile.

  • packages/backend-common/package.json: mysql2 dev dependency bumped from ^2.2.5 to ^3.0.0
  • packages/backend-test-utils/package.json: mysql2 dependency bumped from ^2.2.5 to ^3.0.0
  • yarn.lock: Replaces legacy mysql2 v2 transitive deps (seq-queue, sqlstring, lru-cache@^6, long@^4) with v3 equivalents (aws-ssl-profiles, sql-escaper, lru.min, long@^5.3.2)
  • yarn.lock: Pins older @backstage/* package versions for @backstage/core-plugin-api and @backstage/plugin-gitops-profiles workspaces
  • yarn.lock: Adds transitive dependencies for pinned Backstage workspaces (react-markdown@^5, material-table, jspdf, html2canvas, react-hook-form@^6, etc.)
  • yarn.lock: Updates shared packages: core-js@3.49.0, cross-fetch@3.2.0, node-fetch@2.7.0, dompurify@2.5.9, domutils@3.2.2, entities@4.5.0

Confidence Score: 3/5 - Review Recommended

Likely safe but review recommended — this PR correctly upgrades mysql2 from v2 to v3 across packages/backend-common/package.json and packages/backend-test-utils/package.json to address known security vulnerabilities, and the lockfile has been updated to swap in v3-compatible transitive dependencies. However, a pre-existing unresolved concern about whether the ^3.0.0 semver range in packages/backend-test-utils/package.json resolves to a fully patched 3.x release remains open — the ^ range could still allow resolution to a vulnerable 3.x minor/patch if the lockfile pins an insufficiently recent version. This needs explicit confirmation that the resolved yarn.lock entry for mysql2 points to a version that is free of the specific CVEs motivating this security upgrade.

Key Findings:

  • The ^3.0.0 semver range in packages/backend-test-utils/package.json and packages/backend-common/package.json does not guarantee resolution to the latest patched release; the actual security posture depends entirely on which specific 3.x version is pinned in yarn.lock, and this has not been verified or confirmed in review.
  • The lockfile change swaps in new transitive dependencies (aws-ssl-profiles, sql-escaper, lru.min, long@^5.3.2) that have not been reviewed for their own security or compatibility posture — particularly aws-ssl-profiles, which is a new addition with network/TLS implications.
  • The PR does achieve its stated goal of moving off the vulnerable mysql2 v2 line and updating the full dependency tree, which is the correct approach for a security bump of this kind.
  • Zero files in the changed set were covered by the current automated review pass, meaning correctness of the lockfile resolution to a safe version has not been programmatically verified.
Files requiring special attention
  • yarn.lock
  • packages/backend-test-utils/package.json
  • packages/backend-common/package.json

@entelligence-ai-pr-reviews
Copy link
Copy Markdown

Walkthrough

This PR upgrades the mysql2 dependency from ^2.2.5 to ^3.0.0 across backend-common and backend-test-utils packages. The yarn.lock is updated to reflect new transitive dependencies introduced by mysql2 v3, along with pinned legacy workspace dependencies for @backstage/core-plugin-api and @backstage/plugin-gitops-profiles, and several shared package version bumps including core-js, cross-fetch, node-fetch, and dompurify.

Changes

File(s) Summary
packages/backend-common/package.json
packages/backend-test-utils/package.json Bumps mysql2 dependency version constraint from ^2.2.5 to ^3.0.0.
yarn.lock Updates lockfile to reflect mysql2 v3 transitive dependency changes (replaces seq-queue, sqlstring, long@^4, lru-cache@^6, iconv-lite@^0.6.3 with aws-ssl-profiles, sql-escaper, long@^5.3.2, lru.min, iconv-lite@^0.7.2, named-placeholders@^1.1.6); pins @backstage/core-plugin-api and @backstage/plugin-gitops-profiles to older npm versions with legacy transitive dependencies; bumps core-js to 3.49.0, cross-fetch to 3.2.0, node-fetch to 2.7.0, dompurify to 2.5.9, domutils to 3.2.2, entities to 4.5.0, long to 5.3.2, and @types/unist to 2.0.11.

Sequence Diagram

This diagram shows the interactions between components:

sequenceDiagram
    title mysql2 v3 Upgrade and Dependency Updates

    participant BC as backend-common
    participant BTU as backend-test-utils
    participant mysql2 as mysql2 library
    participant deps as Internal Dependencies

    Note over BC, BTU: mysql2 upgraded from v2 to v3
    BC->>mysql2: require mysql2 v3
    BTU->>mysql2: require mysql2 v3

    Note over mysql2, deps: v3 replaces internal dependencies
    mysql2->>deps: uses aws-ssl-profiles (new in v3)
    mysql2->>deps: uses iconv-lite v0.7 (was v0.6)
    mysql2->>deps: uses long v5.3 (was v4)
    mysql2->>deps: uses lru.min (replaces lru-cache)
    mysql2->>deps: uses named-placeholders v1.1.6
    mysql2->>deps: uses sql-escaper (replaces sqlstring)
    mysql2->>deps: removes seq-queue (dropped in v3)
    mysql2->>deps: removes denque v2.0 (now requires v2.1)

    Note over BC, BTU: Other shared dependency upgrades
    BC->>deps: cross-fetch v3.2 (was v3.1)
    BC->>deps: node-fetch v2.7 (was v2.6)
    BC->>deps: core-js v3.49 (was v3.31)
    BC->>deps: dompurify v2.5 (was v2.4)

    participant GPS as plugin-gitops-profiles
    participant CPA as core-plugin-api

    Note over GPS, CPA: Backstage packages pinned to older versions
    GPS->>deps: pins core-components to 0.1.0
    GPS->>deps: pins core-plugin-api to 0.1.0
    GPS->>deps: pins config to 0.1.1
    GPS->>deps: pins theme to 0.1.1

    CPA->>deps: pins config to 0.1.1
    CPA->>deps: pins version-bridge to 0.1.0

    Note over GPS, deps: Pinned pkgs pull in older transitive deps
    GPS->>deps: react-markdown v5 and remark-gfm v1
    GPS->>deps: react-syntax-highlighter v15.6
    GPS->>deps: material-table v1.69 with jspdf v2.1
Loading

🔗 Cross-Repository Impact Analysis

Enable automatic detection of breaking changes across your dependent repositories. → Set up now

Learn more about Cross-Repository Analysis

What It Does

  • Automatically identifies repositories that depend on this code
  • Analyzes potential breaking changes across your entire codebase
  • Provides risk assessment before merging to prevent cross-repo issues

How to Enable

  1. Visit Settings → Code Management
  2. Configure repository dependencies
  3. Future PRs will automatically include cross-repo impact analysis!

Benefits

  • 🛡️ Prevent breaking changes across repositories
  • 🔍 Catch integration issues before they reach production
  • 📊 Better visibility into your multi-repo architecture

@augmentcode
Copy link
Copy Markdown

augmentcode Bot commented Apr 15, 2026

🤖 Augment PR Summary

Summary: Updates the repository’s MySQL driver dependency to the mysql2 v3 major line to address multiple upstream security advisories.

Changes:

  • Bumped mysql2 from ^2.2.5 to ^3.0.0 in @backstage/backend-common devDependencies.
  • Bumped mysql2 from ^2.2.5 to ^3.0.0 in @backstage/backend-test-utils dependencies (used by Knex-based MySQL test helpers).
  • Updated yarn.lock accordingly (lockfile change not shown in this diff view).

Technical Notes: The intent is to pull in mysql2 3.x releases that include fixes for multiple CVEs (including RCE/code-injection issues) while keeping usage via the existing Knex client: 'mysql2' integration.

🤖 Was this summary useful? React with 👍 or 👎

Copy link
Copy Markdown

@augmentcode augmentcode Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. 1 suggestion posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

"knex": "^2.0.0",
"msw": "^1.0.0",
"mysql2": "^2.2.5",
"mysql2": "^3.0.0",
Copy link
Copy Markdown

@augmentcode augmentcode Bot Apr 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mysql2 is bumped to ^3.0.0, but that semver range still includes known-vulnerable 3.x releases mentioned in the PR description; can you confirm the updated yarn.lock resolves to a patched version (e.g., >= 3.9.8) so the security fix is actually effective? Other locations where this applies: packages/backend-common/package.json:142.

Severity: medium

Other Locations
  • packages/backend-common/package.json:142

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

@socket-security
Copy link
Copy Markdown

socket-security Bot commented Apr 15, 2026

Warning

Review the following alerts detected in dependencies.

According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.

Action Severity Alert  (click "▶" to expand/collapse)
Warn High
License policy violation: npm argparse under Python-2.0.1

License: Python-2.0.1 - The applicable license policy does not permit this license (5) (package/LICENSE)

From: ?npm/argparse@2.0.1

ℹ Read more on: This package | This alert | What is a license policy violation?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Find a package that does not violate your license policy or adjust your policy to allow this package's license.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/argparse@2.0.1. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
License policy violation: npm typescript under W3C-20150513

License: W3C-20150513 - The applicable license policy does not permit this license (5) (package/ThirdPartyNoticeText.txt)

License: LicenseRef-W3C-Community-Final-Specification-Agreement - The applicable license policy does not permit this license (5) (package/ThirdPartyNoticeText.txt)

License: MIT-Khronos-old - The applicable license policy does not permit this license (5) (package/ThirdPartyNoticeText.txt)

License: CC-BY-4.0 - The applicable license policy does not permit this license (5) (package/ThirdPartyNoticeText.txt)

From: packages/repo-tools/package.jsonnpm/typescript@4.8.4

ℹ Read more on: This package | This alert | What is a license policy violation?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Find a package that does not violate your license policy or adjust your policy to allow this package's license.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/typescript@4.8.4. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

@github-actions
Copy link
Copy Markdown

This PR has been automatically marked as stale because it has not had recent activity from the author. It will be closed if no further activity occurs. If the PR was closed and you want it re-opened, let us know and we'll re-open the PR so that you can continue the contribution!

@github-actions github-actions Bot added the stale label Apr 28, 2026
Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
@renovate renovate Bot force-pushed the renovate/npm-mysql2-vulnerability branch from bba6dd6 to b4cfe00 Compare April 30, 2026 02:25
@github-actions github-actions Bot removed the stale label Apr 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants